package com.sobey.web.core;

import org.springframework.context.ApplicationContext;

public class SB_SpringContext {

	private static ApplicationContext applicationContext;
	
	private static SB_SpringContext springContext;
	
	private SB_SpringContext() {
		
	}
	
	public static SB_SpringContext getInstance() {
		if (springContext == null){
			springContext = new SB_SpringContext();
		}
		
		return springContext;
	}

	public static ApplicationContext getApplicationContext() {
		return applicationContext;
	}

	public static void setApplicationContext(ApplicationContext applicationContext) {
		SB_SpringContext.applicationContext = applicationContext;
	}
	
	public static Object getBean(String beanName) {
		return SB_SpringContext.getInstance().getApplicationContext().getBean(beanName);
	}
}
